{% extends "common/layout1.html" %}
{% block content %}
    {#标题#}
    <div class="row">
        <div class="col-md-10 col-md-offset-1 ">
            <div class="row">
                <div class="col-sm-10 ">
                    <h2>人才盘点库</h2>
                </div>
            </div>
        </div>
    </div>


    <div class="row">
        <div class="col-md-10 col-md-offset-1 ">

            {#搜索#}

            <div class="row search">

                <div class="col-sm-2 ">
                    <label>所属公司</label>
                    <select class="selectpicker form-control" ata-live-search="true"
                            title="请选择" data-hide-disabled="true" multiple name="company">
                        <option>不限</option>
                        <optgroup label="集团/区域公司">
                            <option>材料供应公司西北区域</option>
                            <option>地产集团总部</option>
                            <option>西北区域公司</option>
                        </optgroup>
                        <optgroup label="山西公司">
                            <option>山西公司</option>
                            <option>山西公司-大同公司</option>
                            <option>山西公司-临汾项目公司</option>
                            <option>山西公司-太原公司</option>
                            <option>山西公司-长治项目公司</option>
                        </optgroup>
                        <optgroup label="内蒙古公司">
                            <option>内蒙古公司</option>
                            <option>内蒙古城市更新集团</option>
                            <option>内蒙古公司-包头公司</option>
                            <option>内蒙古公司-呼和浩特公司</option>
                            <option>内蒙古公司-通辽项目公司</option>
                            <option>内蒙古公司-乌兰察布项目公司</option>
                        </optgroup>
                        <optgroup label="陕西公司">
                            <option>陕西公司</option>
                            <option>陕西城市更新集团</option>
                            <option>陕西公司-宝鸡项目公司</option>
                            <option>陕西公司-渭南项目公司</option>
                            <option>陕西公司-西安公司</option>
                        </optgroup>
                        <option>西北区域兰州公司</option>
                        <option>西北区域乌鲁木齐公司</option>

                    </select>
                </div>

                <div class="col-sm-2 ">
                    <label>所属部门</label>
                    <select class="selectpicker form-control" name="department" ata-live-search="true"
                            title="请选择" data-hide-disabled="true" multiple>
                        <optgroup label="集团/区域共享部门">
                            <option>西北区域总监及以上</option>
                            <option>人力行政中心</option>
                            <option>集团成本监控中心</option>
                            <option>监察中心</option>
                            <option>法律事务中心</option>
                            <option>集团审计中心</option>
                            <option>招标中心</option>
                            <option>运营中心</option>
                        </optgroup>
                        <optgroup label="材料供应公司">
                            <option>公司总助及以上</option>
                            <option>山西供应部</option>
                            <option>内蒙古供应部</option>
                            <option>陕西供应部</option>
                            <option>山西供应部乌鲁木齐组</option>
                        </optgroup>
                        <optgroup label="省公司">
                            <option>公司总助及以上</option>
                            <option>人事行政部</option>
                            <option>财务部</option>
                            <option>销售策划部</option>
                            <option>工程技术部</option>
                        </optgroup>
                        <optgroup label="项目公司">
                            <option>公司总助及以上</option>
                            <option>开发部</option>
                            <option>工程部</option>
                            <option>销售部</option>
                        </optgroup>
                    </select>
                </div>


                <div class="col-sm-1 ">
                    <label>行政级别</label>
                    <select class="selectpicker form-control" name="hrclass"
                            title="请选择" data-hide-disabled="true" multiple>
                        <option>高级经理/地区公司副总经理</option>
                        <option>高级经理</option>
                        <option>项目公司总经理</option>
                        <option>地区公司经理</option>
                        <option>地区公司副经理</option>
                        <option>地区公司助理经理</option>
                        <option>地区公司主管/高级主管</option>
                        <option>地区公司专员/工程师(高级/中级/初级)</option>
                        <option>销拓</option>
                        <option>编外</option>
                    </select>
                </div>


                <div class="col-sm-2 ">
                    <label>SAP编号</label>
                    <input class="form-control " name="sap">
                </div>


                <div class='col-sm-1'>
                    <div class="form-group">
                        <label></label>
                        <button type="submit" class="btn btn-primary btn-block do-search " id="dosearch">
                            搜索
                        </button>

                    </div>


                    <script type="text/javascript">
                        {#搜索#}
                        var dosearch = {
                            init: function () {
                                this.eventBind()
                            },
                            eventBind: function () {
                                $(".do-search").click(function () {
                                    var company = $(".search select[name=company]").val();
                                    var department = $(".search select[name=department]").val();
                                    var hrclass = $(".search select[name=hrclass]").val();
                                    var sap = $(".search input[name=sap]").val();
                                    var urlindex = common_ops.buildUrl("/person/personsearch?company=") + company + "&department=" + department + "&hrclass=" + hrclass + "&sap=" + sap;
                                    document.location.href = urlindex;

                                });
                            }
                        };
                        $(document).ready(function () {
                            dosearch.init();
                        });
                    </script>
                </div>
            </div>


            {#表格#}
            <row class=" data-table">

                <table class="table table-bordered table-hover">
                    <tr>
                        <th class="info">sap</th>
                        <th class="info">公司</th>
                        <th class="info">部门</th>
                        <th class="info">姓名</th>
                        <th class="info">职位</th>
                        <th class="info">行政级别</th>
                        <th class="info">性别</th>
                        <th class="info">年龄</th>
                        <th class="info">进入集团</th>
                        <th class="info">是否张生</th>
                        <th class="info">操作</th>

                    </tr>
                    {% for item in personindex %}

                        <tr>
                            <th>{{ item.sap }}</th>
                            <th>{{ item.company }}</th>
                            <th>{{ item.department }}</th>
                            <th>{{ item.name }}</th>
                            <th>{{ item.post }}</th>
                            <th>{{ item.hrclass }}</th>
                            <th>{{ item.sex }}</th>
                            <th>{{ item.age }}</th>
                            <th>{{ item.groupdate }}</th>
                            <th>{{ item.isboss }}</th>


                            <th><a class="btn btn-success"
                                   href="{{ buildUrl('/evaluate/evaluate') }}?sap={{ item.sap }}">查看</a>

                                {#                                {% if item.company ==  current_user.company or current_user.company== "西北区域公司" %}#}

                                {#                                <button type="button" class="btn btn-primary" data-toggle="modal"#}
                                {#                                        data-target="#exampleModal" data-type="{{ item.type }}"#}
                                {#                                        data-name="{{ item.name }}" data-address="{{ item.address }}"#}
                                {#                                        data-owner="{{ item.owner }}" data-phone="{{ item.phone }}"#}
                                {#                                        data-gctype="{{ item.gctype }}" data-zytype="{{ item.zytype }}"#}
                                {#                                        data-id="{{ item.id }}" data-linker="{{ item.linker }}"#}
                                {#                                        data-offer="{{ item.offer }}" data-area="{{ item.area }}"#}
                                {#                                        data-title="编辑">编辑#}
                                {#                                </button>#}

                                {#                                <a class="btn btn-danger"#}
                                {#                                   href="{{ buildUrl('/parter/deleteindex') }}?id={{ item.id }}">删除</a>#}

                                {#                                {% endif %}#}

                            </th>
                        </tr>

                    {% endfor %}
                </table>
            </row>

            {#        分页#}
            {% if pages %}
                <div>
                    <p style="margin-left: 5px">共{{ num }}条数据</p>
                    {% include "common/pagenation.html" %}
                </div>
            {% endif %}
        </div>
    </div>


    {#    模态框#}
    {#    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">#}
    {#        <div class="modal-dialog" role="document">#}
    {#            <div class="modal-content">#}
    {#                <div class="modal-header">#}
    {#                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span#}
    {#                            aria-hidden="true">&times;</span></button>#}
    {#                    <h4 class="modal-title" id="exampleModalLabel">新建承建商</h4>#}
    {#                </div>#}
    {#                <div class="modal-body">#}
    {#                    <input type="text" class="invisible" id="uid" name="uid" value="{{ current_user.id }}">#}
    {#                    <input type="text" class="invisible" id="id" name="id">#}
    {##}
    {##}
    {#                    <div class="form-group">#}
    {#                        <label for="recipient-name" class="control-label">所属公司:</label>#}
    {#                        <select class="form-control " id="area" name="area">#}
    {#                            <option>请选择</option>#}
    {#                            <option>山西公司</option>#}
    {#                            <option>陕西公司</option>#}
    {#                            <option>内蒙古公司</option>#}
    {#                            <option>乌鲁木齐公司</option>#}
    {#                            <option>兰州公司</option>#}
    {#                        </select>#}
    {#                    </div>#}
    {##}
    {##}
    {#                    <div class="form-group">#}
    {#                        <label class="control-label">公司名称:</label>#}
    {#                        <input type="text" class="form-control" id="name" name="name">#}
    {#                    </div>#}
    {##}
    {#                    <div class="form-group">#}
    {#                        <label for="recipient-name" class="control-label">公司性质:</label>#}
    {#                        <input type="text" class="form-control" id="type" name="type">#}
    {#                    </div>#}
    {##}
    {#                    <div class="form-group">#}
    {#                        <label for="recipient-name" class="control-label">公司地址:</label>#}
    {#                        <input type="text" class="form-control" id="address" name="address">#}
    {#                    </div>#}
    {##}
    {#                    <div class="form-group">#}
    {#                        <label for="recipient-name" class="control-label">公司法人:</label>#}
    {#                        <input type="text" class="form-control" id="owner" name="owner">#}
    {#                    </div>#}
    {##}
    {#                    <div class="form-group">#}
    {#                        <label for="recipient-name" class="control-label">公司联系人:</label>#}
    {#                        <input type="text" class="form-control" id="linker" name="linker">#}
    {#                    </div>#}
    {##}
    {#                    <div class="form-group">#}
    {#                        <label for="recipient-name" class="control-label">联系方式:</label>#}
    {#                        <input type="number" class="form-control" id="phone" name="phone">#}
    {#                    </div>#}
    {##}
    {##}
    {#                    <div class="form-group">#}
    {#                        <label for="recipient-name" class="control-label">专业类型:</label>#}
    {#                        <select class="selectpicker form-control " id="zytype" name="zytype" multiple>#}
    {#                            <option>A</option>#}
    {#                            <option>B</option>#}
    {#                        </select>#}
    {#                    </div>#}
    {##}
    {##}
    {#                    <div class="cform-group">#}
    {#                        <label for="recipient-name" class="control-label">工程类型:</label>#}
    {#                        <select class="selectpicker form-control" id="gctype" name="gctype" data-live-search="true"#}
    {#                                title="请选择" data-hide-disabled="true"#}
    {#                                multiple>#}
    {#                            <optgroup label="A">#}
    {#                                {% for item in parterclassa %}#}
    {#                                    <option>{{ item.name }}</option>#}
    {#                                {% endfor %}#}
    {#                            </optgroup>#}
    {#                            <optgroup label="B">#}
    {#                                {% for item in parterclassb %}#}
    {#                                    <option>{{ item.name }}</option>#}
    {#                                {% endfor %}#}
    {#                            </optgroup>#}
    {#                        </select>#}
    {#                    </div>#}
    {##}
    {##}
    {#                    <div class="form-group">#}
    {#                        <label for="recipient-name" class="control-label">推荐人/部门:</label>#}
    {#                        <input type="text" class="form-control" id="offer" name="offer">#}
    {#                    </div>#}
    {##}
    {##}
    {#                    <div class="modal-footer">#}
    {#                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>#}
    {#                        <button class="btn btn-primary do-add" type="submit" name="add" id="add">新建存档</button>#}
    {#                        <button class="btn btn-primary do-updata" type="submit" name="updata" id="updata">更新存档</button>#}
    {#                    </div>#}
    {##}
    {#                </div>#}
    {##}
    {#            </div>#}
    {#        </div>#}
    {#    </div>#}
    {##}
    {#    更新文档#}
    {#    <script>#}
    {#        $(".do-updata").click(function () {#}
    {#            var btnaction = $(this);#}
    {#            if (btnaction.hasClass("disable")) {#}
    {#                common_ops.alert("还没提交上去了，别瞎点")#}
    {#                return#}
    {#            }#}
    {##}
    {#            var name = $("input[id=name]").val();#}
    {#            var address = $("input[id=address]").val();#}
    {#            var phone = $("input[id=phone]").val();#}
    {#            var linker = $("input[id=linker]").val();#}
    {#            var owner = $("input[id=owner]").val();#}
    {#            var type = $("input[id=type]").val();#}
    {#            var gctype = $("select[id=gctype]").val().toString();#}
    {#            var zytype = $("select[id=zytype]").val().toString();#}
    {#            var uid = $("input[id=uid]").val();#}
    {#            var id = $("input[id=id]").val();#}
    {#            var offer = $("input[id=offer]").val();#}
    {#            var area = $("select[id=area]").val();#}
    {##}
    {##}
    {#            $.ajax({#}
    {#                url: common_ops.buildUrl("/parter/updataindex"),#}
    {#                type: "POST",#}
    {#                data: {#}
    {#                    name: name,#}
    {#                    address: address,#}
    {#                    owner: owner,#}
    {#                    linker: linker,#}
    {#                    type: type,#}
    {#                    gctype: gctype,#}
    {#                    zytype: zytype,#}
    {#                    phone: phone,#}
    {#                    uid: uid,#}
    {#                    id: id,#}
    {#                    offer: offer,#}
    {#                    area: area,#}
    {#                },#}
    {#                dataType: 'json',#}
    {#                success: function (res) {#}
    {#                    btnaction.removeClass("disabled");#}
    {#                    var callback = null;#}
    {#                    if (res.code == 200) {#}
    {#                        callback = function () {#}
    {#                        };#}
    {#                    }#}
    {#                    common_ops.alert(res.msg, callback);#}
    {#                    setTimeout(function () {#}
    {#                        $('#exampleModal').modal('hide');#}
    {#                        $(".modal-backdrop.fade").hide();#}
    {#                        window.location.href = common_ops.buildUrl("/parter/parterindex");#}
    {#                        $("#exampleModal").trigger("click");#}
    {#                    }, 1000)#}
    {#                }#}
    {#            });#}
    {##}
    {#        });#}
    {#    </script>#}
    {##}
    {##}
    {#    <script>#}
    {#        $(".do-add").click(function () {#}
    {#            var btnaction = $(this);#}
    {#            if (btnaction.hasClass("disable")) {#}
    {#                common_ops.alert("还没提交上去了，别瞎点")#}
    {#                return#}
    {#            }#}
    {##}
    {#            var name = $("input[id=name]").val();#}
    {#            var address = $("input[id=address]").val();#}
    {#            var phone = $("input[id=phone]").val();#}
    {#            var linker = $("input[id=linker]").val();#}
    {#            var owner = $("input[id=owner]").val();#}
    {#            var type = $("input[id=type]").val();#}
    {#            var gctype = $("select[id=gctype]").val().toString();#}
    {#            var zytype = $("select[id=zytype]").val().toString();#}
    {#            var uid = $("input[id=uid]").val();#}
    {#            var offer = $("input[id=offer]").val();#}
    {#            var area = $("select[id=area]").val();#}
    {##}
    {##}
    {#            $.ajax({#}
    {#                url: common_ops.buildUrl("/parter/addindex"),#}
    {#                type: "POST",#}
    {#                data: {#}
    {#                    name: name,#}
    {#                    address: address,#}
    {#                    owner: owner,#}
    {#                    linker: linker,#}
    {#                    type: type,#}
    {#                    gctype: gctype,#}
    {#                    zytype: zytype,#}
    {#                    phone: phone,#}
    {#                    uid: uid,#}
    {#                    offer: offer,#}
    {#                    area: area,#}
    {#                },#}
    {#                dataType: 'json',#}
    {#                success: function (res) {#}
    {#                    btnaction.removeClass("disabled");#}
    {#                    var callback = null;#}
    {#                    if (res.code == 200) {#}
    {#                        callback = function () {#}
    {#                        };#}
    {#                    }#}
    {#                    common_ops.alert(res.msg, callback);#}
    {#                    setTimeout(function () {#}
    {#                        $('#exampleModal').modal('hide');#}
    {#                        $(".modal-backdrop.fade").hide();#}
    {#                        window.location.href = common_ops.buildUrl("/parter/parterindex");#}
    {#                        $("#exampleModal").trigger("click");#}
    {#                    }, 1000)#}
    {##}
    {##}
    {#                }#}
    {#            });#}
    {##}
    {#        });#}
    {#    </script>#}
    {##}
    {##}
    {#    <script>#}
    {#编辑赋值#}
    {#        $('#exampleModal').on('show.bs.modal', function (event) {#}
    {#            var button = $(event.relatedTarget); // Button that triggered the modal#}
    {#            var id = button.data('id');#}
    {#            var title = button.data('title');#}
    {#            var gctype = button.data('gctype').split(",")#}
    {#            var zytype = button.data('zytype').split(",")#}
    {##}
    {#            var modal = $(this)#}
    {#            modal.find('.modal-title').text(title + '承建商');#}
    {##}
    {#            $("input[id=id]").val(id);#}
    {#            $("input[id=name]").val(button.data('name'));#}
    {#            $("input[id=address]").val(button.data('address'));#}
    {#            $("input[id=owner]").val(button.data('owner'));#}
    {#            $("input[id=linker]").val(button.data('linker'));#}
    {#            $("input[id=phone]").val(button.data('phone'));#}
    {#            $("input[id=type]").val(button.data('type'));#}
    {#            $("input[id=offer]").val(button.data('offer'));#}
    {#            $("select[id=zytype]").val(button.data('zytype'));#}
    {#            $("select[name=area]").val(button.data('area'));#}
    {#            $("select[name=gctype]").selectpicker('val', gctype);#}
    {#            $("select[name=zytype]").selectpicker('val', zytype);#}
    {##}
    {##}
    {#            if (typeof (id.length) == 'undefined') {#}
    {#                document.getElementById("add").style.display = "none";#}
    {#                document.getElementById("updata").style.display = "";#}
    {##}
    {#            } else {#}
    {#                document.getElementById("updata").style.display = "none";#}
    {#                document.getElementById("add").style.display = "";#}
    {#            }#}
    {##}
    {##}
    {#        });#}
    {#    </script>#}



{% endblock %}


{% block js %}

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="{{ buildStaticUrl('/plugins/bootstrap-select/bootstrap-select.css') }}">

    <script src="{{ buildStaticUrl('/js/jquery1.11.3.js') }}"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="{{ buildStaticUrl('/plugins/bootstrap-select/bootstrap-select.js') }}"></script>

{% endblock %}
